import request from '../utils/request.js'


/* 发布文章 */
export const postArticleApi = (data) => {
	return request({
		method: 'POST',
		url: '/post',
		data
	})
}

/* 编辑文章 */

export const updateArticleApi = (id , data) => {
	return request({
		method: 'POST',
		url: `/post_update/${id}`,
		data
	})
}

/* 文章列表 */
export const getPostApi = (params) => {
	return request({
		method: 'GET',
		url: '/post',
		params: params
	})
}

/* 文章详情 */
export const getPostDetailsApi = (id) => {
	return request({
		method: 'GET',
		url: `/post/${id}`,
	})
}


/* 点赞文章 */
export const updatePostLikeApi = (id) => {
	return request({
		method: 'GET',
		url: `/post_like/${id}`,
	})
}


/* 收藏文章 */
export const updatePostcollectApi = (id) => {
	return request({
		method: 'GET',
		url: `/post_star/${id}`,
	})
}


/* 文章评论 */
export const articleCommentApi = (id , params) => {
	return request({
		method: 'GET',
		url: `/post_comment/${id}`,
		params
	})
}

/* 发布评论 */
export const postCommentApi = (id , data) => {
	return request({
		method: 'POST',
		url: `/post_comment/${id}`,
		data
	})
}

/* 热门搜索 */
export const hotSearchRecommendApi = (params) => {
	return request({
		method: 'GET',
		url: '/post_search_recommend',
		params
	})
}


export const SearchArticleApi = (params) => {
	return request({
		method: 'GET',
		url: '/post_search',
		params
	})
}

